﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace University.Workshop.Presenters.Kardex.Modify
{
    public class PresenterFirstStepForModifyKardex
    {
        private IFirstStepForModifyKardex view;

        public PresenterFirstStepForModifyKardex(IFirstStepForModifyKardex View)
        {
            view = View;
        }

        public void ChargePhonesToList()
        {
            view.PersonPhones = view.PersonNewPhones.Split(',').ToList().Where(x => x != string.Empty).ToList();
        }

        public void ChargeDataKardexPersonData()
        {
            view.KardexToModify.Person.Names = view.PersonNames;
            view.KardexToModify.Person.LastNames = view.PersonLastNames;
            view.KardexToModify.Person.Phone = view.PersonNewPhones;
        }

        public void UpdatePersonData()
        {
            view.PersonId = view.KardexToModify.Person.PersonId;
            view.PersonNames = view.KardexToModify.Person.Names;
            view.PersonLastNames = view.KardexToModify.Person.LastNames;
            view.PersonNewPhones = view.KardexToModify.Person.Phone;
            ChargePhonesToList();
        }
    }
}
